using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMFacturas
    {
        public BMFacturas(string coneccion)
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        DAFacturas daFacturas = new DAFacturas();
        List<Facturas> listaFacturas = new List<Facturas>();

        #region FacturasGetOne
        public Facturas FacturasGetOne(Facturas factura)
        {
            try
            {
                Facturas oFactura = daFacturas.DAFacturasGetOne(connection,factura);
                return oFactura;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region FacturasInsert
        public void FacturasInsert(Facturas factura)
        {
            try
            {
                daFacturas.DAFacturasInsert(connection, factura);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region FacturasProximoNumero
        public int FacturasProximoNumero(Facturas factura)
        {
            int iProximo = 0;
            try
            {
                iProximo = daFacturas.DAFacturaProximoNumero(connection, factura);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
            return iProximo;
        }
        #endregion
    }
}

